package com.lnsf.service.impl;
/**
 * 2017.07.26
 * @author Daen
 *
 */
import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


import com.lnsf.dao.OrdersDao;
import com.lnsf.entity.Orders;
import com.lnsf.service.IOrdersService;

@Service

public class OrdersServiceImpl implements IOrdersService{
	@Autowired
	private OrdersDao ordersDao;
	
	
	
	@Transactional(readOnly=true)
	public Page<Orders> getPage(int pageNo, int pageSize){
		PageRequest pageable = new PageRequest(pageNo - 1, pageSize);
		return ordersDao.findAll(pageable);
	}
	
	@Transactional
	public void delete(Integer id){
		ordersDao.delete(id);
	}
	
	@Transactional(readOnly=true)
	public Orders getOrders(Integer id){
		return ordersDao.findOne(id);
	}

	@Transactional
	public Orders saveOrders(Orders orders) {
		// TODO Auto-generated method stub
		orders.setCreateTime(new Date());
	return	ordersDao.save(orders);
	}

	@Override
	public int updateOrders(int id,String describle) {
		// TODO Auto-generated method stub
		return ordersDao.updateOrders(id,describle);
	}

	


	
	}

